package org.bsc.mgwt.client.widget;

import com.google.gwt.dom.client.InputElement;
import com.google.gwt.uibinder.client.UiConstructor;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Element;
import com.googlecode.mgwt.ui.client.theme.base.InputCss;
import com.googlecode.mgwt.ui.client.widget.MRadioButton;

public class MCheckButton extends MRadioButton {

	@UiConstructor
	public MCheckButton( String name ) {
		super(name);
	}

	public MCheckButton(InputCss css, String name) {
		super(css, name);
	}

	/**
	 * factory method to create input element
	 * 
	 * @param name
	 * @return
	 */	
	protected Element createInputElement( final String name ) {
		Element e = DOM.createInputCheck();
		InputElement.as(e).setName(name);
		return e;

	}

	/**
	 * set the value of element on touch event
	 * 
	 * @param element on which set value
	 */
	protected void setValueOnTouch( InputElement element ) {
		element.setChecked( !element.isChecked() );
	}

}
